<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=<script src=" ./Mypromise.js">
	<script src="./Mypromise.js"></script>
</head>

<body>
	<script>
		/* const PENDING = 'PENDING';
		const FULFILLED = 'FUlFILLED';
		const REJECTED = 'REJECTED';

		class MyPromise {
		constructor(executor){
		this.status = PENDING;
		this.value = undefined;
		this.reason = undefined;
		let resolve = () =>{
		if(this.status === PENDING){
			this.status = FULFILLED;
			this.value = value;
			}
		}
		let reject = () =>{
		if(this.status === PENDING){
			this.status = REJECTED;
			this.reason = reason;
		}
	}
	try {
	executor(resolve,reject);
	}catch(error){
		error
	}
}
then(onFulfilled,onRejected){
	if(this.status === FULFILLED){
		onFulfilled(this.value);
	}
	if(this.status === REJECTED){
		onRejected(this.reason);
	}
}
} */

		const promise = new MyPromise((resolve, reject) => {
			setTimeout(() => {
				resolve('成功')
			}, 1000)
		}).then().then().then((data) => {
			console.log('success', data)
		}, (err) => {
			console.log('faild', err)
		}).
	</script>
</body>

</html>